package com.example.myapplication;

import android.util.Log;

import androidx.annotation.NonNull;
import androidx.lifecycle.DefaultLifecycleObserver;
import androidx.lifecycle.LifecycleOwner;

public class MyObserver implements DefaultLifecycleObserver {

    private static final String TAG = "MyObserver";
    
    @Override
    public void onCreate(@NonNull LifecycleOwner owner) {
        StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
        for (StackTraceElement stackTraceElement : stackTrace) {
            Log.d(TAG, "onCreate: "+ stackTraceElement.getClassName() + " - " + stackTraceElement.getMethodName());
        }
    }

    @Override
    public void onResume(@NonNull LifecycleOwner owner) {
        DefaultLifecycleObserver.super.onResume(owner);
    }
}
